export default {
  data() {
    return {
      mapList: [
        {
          id: '11',
          name: '北京市'
        },
        {
          id: '12',
          name: '天津市'
        },
        {
          id: '13',
          name: '河北省'
        },
        {
          id: '14',
          name: '山西省'
        },
        {
          id: '15',
          name: '内蒙古自治区'
        },
        {
          id: '21',
          name: '辽宁省'
        },
        {
          id: '22',
          name: '吉林省'
        },
        {
          id: '23',
          name: '黑龙江省'
        },
        {
          id: '31',
          name: '上海市'
        },
        {
          id: '32',
          name: '江苏省'
        },
        {
          id: '33',
          name: '浙江省'
        },
        {
          id: '34',
          name: '安徽省'
        },
        {
          id: '35',
          name: '福建省'
        },
        {
          id: '36',
          name: '江西省'
        },
        {
          id: '37',
          name: '山东省'
        },
        {
          id: '41',
          name: '河南省'
        },
        {
          id: '42',
          name: '湖北省'
        },
        {
          id: '43',
          name: '湖南省'
        },
        {
          id: '44',
          name: '广东省'
        },
        {
          id: '45',
          name: '广西壮族自治区'
        },
        {
          id: '46',
          name: '海南省'
        },
        {
          id: '50',
          name: '重庆市'
        },
        {
          id: '51',
          name: '四川省'
        },
        {
          id: '52',
          name: '贵州省'
        },
        {
          id: '53',
          name: '云南省'
        },
        {
          id: '54',
          name: '西藏自治区'
        },
        {
          id: '61',
          name: '陕西省'
        },
        {
          id: '62',
          name: '甘肃省'
        },
        {
          id: '63',
          name: '青海省'
        },
        {
          id: '64',
          name: '宁夏回族自治区'
        },
        {
          id: '65',
          name: '新疆维吾尔自治区'
        },
        {
          id: '71',
          name: '台湾省'
        },
        {
          id: '81',
          name: '香港特别行政区'
        },
        {
          id: '82',
          name: '澳门特别行政区'
        }
      ]
    }
  },
  methods: {
    // 获取省份id
    getProId(name) {
      for (const i in this.mapList) {
        if (this.mapList[i].name == name) {
          return this.mapList[i].id
        }
      }
    },
    // 获取市id
    getCityId(geoJson, name) {
      const result = JSON.parse(geoJson)
      for (const i in result.features) {
        if (result.features[i].properties.name == name) {
          // console.log(result.features[i].properties)
          // return result.features[i].properties.id + '00'
          return result.features[i].properties.id
        }
      }
    }
  }
}
